<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('功能设置')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-docset-edit" th:object="${sysSmtp}">
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label">系统邮箱：</label>
                <div class="col-sm-8">
                    <input name="email" th:field="*{email}" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label">用户名：</label>
                <div class="col-sm-8">
                    <input name="username" th:field="*{username}" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label">密码：</label>
                <div class="col-sm-8">
                    <input name="password" th:field="*{password}" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label">SMTP服务器：</label>
                <div class="col-sm-8">
                    <input name="smtp" th:field="*{smtp}" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label">端口：</label>
                <div class="col-sm-8">
                    <input name="port" th:field="*{port}" class="form-control" type="text">
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">测试收件人：</label>
                    <div class="col-sm-8">
                        <input name="emailTo" th:field="*{emailTo}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">测试内容：</label>
                    <div class="col-sm-8">
                        <input name="emailBody" th:field="*{emailBody}" class="form-control" type="text">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-offset-5 col-sm-10">
                <button type="button" th:if="${@permission.hasPermi('system:smtp:edit')}" class="btn btn-sm btn-primary " onclick="submitHandler()"><i class="fa fa-check"></i>保存并发送测试邮件</button>&nbsp;
            </div>
        </div>
        <div class="row">

        </div>

    </form>
    <div class="row" style="position: relative">
        <div class="col-xs-12" style="position: absolute;left: 30%">
        <h4>可设置为自己邮箱SMTP信息，需要登录邮箱开启POP3/SMTP服务：</h4>
        <br>
        <p>QQ邮箱SMTP：smtp.qq.com</p>
        <p> SMTP端口：25</p>
        <p> 密码需要填写授权码</p>
        <br>
        <p>QQ邮箱SMTP：ssl://smtp.qq.com</p>
        <p>SMTP端口：465 或 587</p>
        <p>QQ邮箱密码为授权码，不是登录密码</p>
        <br>
        <p>163邮箱SMTP：smtp.163.com</p>
        <p>SMTP端口：25</p>
        <br>
        <p>新浪邮箱SMTP：smtp.sina.com</p>
        <p>SMTP端口：25</p>
        </div>
    </div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
    var prefix = ctx + "system/smtp";
    $("#form-docset-edit").validate({
        focusCleanup: true
    });
    function submitHandler() {
        if ($.validate.form()) {
            var data = $('#form-docset-edit').serializeArray();
            $.operate.save(prefix + "/edit", data,function(result) {
                layer.msg(result.msg, {
                    icon: $.modal.icon(0),
                    time: 500,
                    shade: [0.1, '#8F8F8F']
                });
            });
        }
    }
</script>
</body>
</html>